package com.yanqu.road.web.controller.game;

import com.yanqu.road.server.manger.WhiteIpMgr;
import com.yanqu.road.web.util.IpAddressHelper;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/adminlogin")
public class WhiteIpLogin extends WebLogin {

	private static final long serialVersionUID = 5583359657074057629L;

	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String ip = IpAddressHelper.getIpAddr(request);
		if (WhiteIpMgr.isPlayerWhiteIp(ip)) {
			super.doPost(request, response);
		}
	}
}
